<template>
	<el-dialog :title="dialogTitle" :visible.sync="visible" width="560px" top="0" append-to-body>
		<el-form v-bind="formConfig" :model="formData" :rules="formRules" label-width="80px" v-loading="loading">
			<el-row :gutter="16">
				<el-col :span="24">
					<el-form-item label="栏目名称" prop="name">
						<el-input v-model="formData.name" placeholder="请输入栏目名称"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="type === '1' ? 12 : 24">
					<el-form-item label="栏目编码" prop="code">
						<sw-letter-input v-model="formData.code" placeholder="请输入栏目编码"></sw-letter-input>
					</el-form-item>
				</el-col>
				<template v-if="type === '1'">
					<el-col :span="12">
						<el-form-item label="英文名称" prop="field4">
							<sw-letter-input v-model="formData.field4" placeholder="请输入英文名称"></sw-letter-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="二级标题" prop="field1">
							<el-input v-model="formData.field1" placeholder="请输入二级标题"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="栏目地址" prop="field3">
							<sw-letter-input v-model="formData.field3" placeholder="请输入栏目地址"></sw-letter-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="是否显示在菜单栏" prop="field2" label-width="136px">
							<el-radio-group v-model="formData.field2" v-removeAriaHidden>
								<el-radio label="0">显示</el-radio>
								<el-radio label="1">隐藏</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</template>
				<el-col :span="12">
					<el-form-item label="是否显示" prop="isShow">
						<el-switch v-model="formData.isShow" active-value="0" inactive-value="1" />
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="排序" prop="orderBy">
						<el-input-number v-model="formData.orderBy" controls-position="right" :min="1" style="width: 100%" />
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="栏目描述">
						<el-input type="textarea" v-model="formData.content" placeholder="请输入栏目描述"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
		</el-form>
		<template slot="footer">
			<el-button size="medium" @click="visible = false">取消</el-button>
			<el-button size="medium" type="primary" @click="handleSubmitForm()">确定</el-button>
		</template>
	</el-dialog>
</template>

<script>
import formMixins from '@/mixins/formMixins';
import { columnControlDetail, addedColumnControl, updateColumnControl } from '@/api/system/sysColumnControl';
export default {
	mixins: [formMixins],
	props: {
		type: { type: String, default: '' }
	},
	data() {
		return {
			formName: '栏目',
			formRules: {
				name: [{ required: true, message: '请输入栏目名称', trigger: 'blur' }],
				userType: [{ required: true, message: '请选择栏目类型', trigger: 'change' }],
				dataScope: [{ required: true, message: '请选择数据权限等级', trigger: 'change' }]
			},
			defaultProps: { label: 'name', children: 'childList' }
		};
	},
	computed: {
		detailData() {
			return eval(columnControlDetail);
		},
		callFunction() {
			return eval(this.addOrEdit ? addedColumnControl : updateColumnControl);
		}
	},
	methods: {}
};
</script>
